﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="generator" content="editplus" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
<link href="<?=base_url()?>assets/css/reset.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>assets/css/public.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>assets/css/all.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>assets/css/wanwan.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url()?>assets/css/ui-lightness/jquery-ui-1.10.2.custom.css" rel="stylesheet">
<link href="<?=base_url()?>assets/css/all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?=base_url()?>assets/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="<?=base_url()?>assets/js/jquery-ui-1.10.2.custom.min.js"></script>
<script type="text/javascript" src="<?=base_url()?>assets/js/operate.js"></script>
<script type="text/javascript">
$(function() {
	$(".delReceivedLetter").each(function() {
		$(this).click(function() {
			var letterId = $(this).attr("title");
			$.ajax({
				type:"POST",
				url:"<?=base_url()?>index.php/stationLetters/deleteReceivedLetterById",
				data:"letterId="+letterId,
				success:function() {
					location.reload();
				}
			});
		});
	})
	
	$(".replyReceivedLetter").each(function() {
		$(this).click(function() {
			$("#dlgReply").css("display","block");
			var letterId = $(this).attr("title");
			$.ajax({
				type:"GET",
				url:"<?=base_url()?>index.php/stationLetters/echoJsonReceivedLetterContentById",
				data:"letterId="+letterId,
				dataType:"json",
				success:function(data) {
					//alert(data.sender);
					$("#letter_type").val(data.letter_type);
					$("#recipient").val(data.recipient);
					$("#sender").val(data.sender);
					$("#letter_title").val(data.letter_title);
					$("#letter_content").val("----------------------原始信件----------------------<br/>"+
						data.letter_content+
						"<br/>----------------------回复信件----------------------<br/>");
					$( "#dlgReply" ).dialog("open");
				}
			});
		})
	});
})
</script>
<!--[if IE 6]>
<script src="js/iepngfx.js" language="javascript" type="text/javascript"></script>
<![endif]-->
<title>湾湾网-简单就是分享</title>
</head>

<body>
<div class="wrap">
	<div class="header">
		<div class="head">
			<h1 style=" background:url(<?=base_url()?>assets/images/logo.png) no-repeat; width:280px; height:60px;"></h1>
			<ul>
				<li><a href="#" class="sy"><strong>首页</strong></a></li>
				<li><a href="#"><strong>我的主页</strong></a></li>
				<li><a href="#"><strong>团体主页</strong></a></li>
				<li><a href="#"><strong>+</strong></a></li>
			</ul>
			<div class="head_rg">
				<div class="search">
					<input type="text" class="sch_txt" />
					<input type="button" class="sch_but" />
				</div>
				<div class="head_rgimg">
					<a href="#"><img src="<?=base_url()?>assets/images/nav_03.gif" width="14" height="14" /></a>
					<a href="#"><img src="<?=base_url()?>assets/images/nav_04.gif" width="14" height="14" /></a>
					<a href="#"><img src="<?=base_url()?>assets/images/nav_05.gif" width="14" height="14" /></a>
				</div>
			</div>
		</div>
	</div><!-- end header -->
	<div class="content">
		<div class="xinx_left">
			<div class="bmlf_lf1 xinx_lful">
				<ul>
					<li class="xx1_hover1"><a href="<?=base_url()?>index.php/stationLetters/listReceivedLetters"><strong>我的信箱</strong></a></li>
					<li class="xx1_hover2"><a href="<?=base_url()?>index.php/stationLetters/listReceivedLetters"><strong>收到的</strong></a></li>
					<li class="xx1_hover3"><a href="<?=base_url()?>index.php/stationLetters/listSendLetters"><strong>已发出</strong></a></li>
					<li class="xx1_hover4"><a href="<?=base_url()?>index.php/stationLetters/listUnreadLetters"><strong>收到的提示</strong></a></li>
				</ul>
			</div><!-- end bmlf_lf1 -->
		</div><!-- end xinx_left -->
		
		<div class="xinx_right">
			<div class="xx_rg1">
				<div class="xx_rg11"></div>
				<div class="xx_rg12"><a id="write_letter"><img src="<?=base_url()?>assets/images/wdxx_12.gif" width="94" height="30"/></a></div>
				<div class="xx_rg13"></div>
			</div>
			<div class="xx_rg2">
			
				<?php
					foreach($results as $rs) {
				?>
				<div class="xx_rg21">
					<div class="xx_rig1">
						<p class="rig1_p1">
							<span><strong class="p1str1"><?=$rs->createTime?></strong></span>
							
                            <div class="message_title_img1">
								<span>
									<?php
									if($rs->isRead == "已读") {
									?>
										<img src="<?=base_url()?>assets/images/wdxx_01.gif" />
									<?php
									} else if($rs->isRead =="未读") {
									?>
										<img src="<?=base_url()?>assets/images/wdxx_02.gif" />
									<?php
									}
									?>
								</span>
                            	<span class="message_title_text"><strong><?=$rs->nickName?></strong> 寄来的<?=$rs->letter_type?> <?=$rs->letter_title?></span>
                            </div>
						</p>
						<p class="rig1_p2"><?=strlen($rs->letter_content)>=256?substr($rs->letter_content,0,256).'...':$rs->letter_content ?></p>
						<p class="rig1_p3">
							<a href="javascript:void(0);" class="delReceivedLetter" title="<?=$rs->letterId?>">删除</a>
							<a href="javascript:void(0);" class="replyReceivedLetter" title="<?=$rs->letterId?>">回复</a>
							<a href="<?=base_url()?>/index.php/stationLetters/queryReceivedLetterContentById?letterId=<?=$rs->letterId?>" target="_blank">+阅读全部</a>
						</p>
					</div>
				</div><!-- end xx_rg21 -->
				<?php
					}
				?>			
			</div>
			<div class="xx_rg3"></div>
		</div><!-- end xinx_right -->
	</div><!-- end content -->
	
	<div class="footer">
		<p class="foot_p">点点网2012探索点点 点点推荐 京ICP备10217266号 京公网安备110108008162号</p>
	</div>
</div><!-- end wrap -->
<div id="dialog" title="站内信" class="ui-widget" style="display:none;">
	<form id="dlg_write_letter" action="<?=base_url()?>index.php/stationLetters/writeLetter" method="post">
		<table height="100%">
			<tr height="40">
				<td>收件人：</td>
				<td>
					<input type="text" size="30"/>
					<input type="hidden" name="recipient" value="2"/>
				</td>
			</tr>
			<tr height="40"><td>类型：</td><td><input type="text"  name="letter_type" size="30"/></td></tr>
			<tr height="40"><td>主题：</td><td><input type="text"  name="letter_title" size="30"/></td></tr>
			<tr height="40"><td>内容：</td><td><textarea cols="50" name="letter_content" rows="15"></textarea></td></tr>
		</table>
	</form>
</div>
<div id="dlgReply" style="display:none;position:absolute;left:30%;top:30%;width:700px; height:393px;">
	<input type="button" class="message_close" />
	<div class="message_box">
		<div class="message_wrap">
			<form id="dlg_reply_letter" action="<?=base_url()?>index.php/stationLetters/replyLetter" method="post">
				<p>
					<label>类型：</label>
					<input type="text"  name="letter_type" id="letter_type" class="message_txt_bg"/>
					<input type="hidden" name="recipient" id="recipient" value=""/>
					<input type="hidden" name="sender" id="sender" value=""/>
					<input type="hidden" name="isRead" value="未读"/>
					<input type="hidden" name="createTime" value="<?=date('Y-m-d H:i:s')?>"/>
				</p>
				<p>
					<label>主题：</label>
					<input type="text"  name="letter_title" id="letter_title" class="message_txt_bg"/>
				</p>
				<p>
					<label>内容：</label>
					<textarea cols="50" name="letter_content" id="letter_content" rows="15" class="message_txtarea"></textarea>
				</p>
				<p style="margin-left:70px;"><input type="button" class="send_btn" /><input type="button" class="quxiao_btn"/></p>
			</form>
	   </div>		
	</div>
</div>
</body>
</html>
